/*
 * @Author: liuxiao
 * @Date: 2023-11-20 21:13:58
 * @Last Modified by: liuxiao
 * @Last Modified time: 2023-11-21 00:35:10
 * @ps:保存课程相关的小仓库
 */
import { defineStore } from 'pinia'

const useCourseStore = defineStore('course', {
  //小仓库存储数据的地方,相当于data
  state: () => {
    return {
      age: 30
    }
  },
  getters: {
    //相当于computed计算属性，接受一个参数，就是state
    getterAge(state) {
      return state.age + 5
    }
  },
  actions: {
    //相当于methods
    addAge() {
      //this指向对应的仓库
      this.age++
    }
  }
})
